﻿<Controls:MetroWindow x:Class="PurchaseSales.Manage.Views.ShellView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" 
        xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro" 
xmlns:local="clr-namespace:PurchaseSales.Manage.Common"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
                      Title="PurchaseSales.Manage" Height="500" Width="800" 
        WindowStartupLocation="CenterScreen" >
    <Controls:MetroWindow.Resources>

        <Style TargetType="{x:Type Button}" x:Key="RoundButtonBaseStyle">
            <Setter Property="Foreground" Value="#8D8D8D"/>
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Cursor" Value="Hand"/>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="true">
                    <Setter Property="Background" Value="#8D8D8D"/>
                    <Setter Property="Foreground" Value="White"/>
                </Trigger>
                <Trigger Property="IsEnabled" Value="false">
                    <Setter Property="Opacity" Value="0.5"/>
                </Trigger>
            </Style.Triggers>
        </Style>
        <Style TargetType="{x:Type Button}" x:Key="NavigateRightButtonStyle" BasedOn="{StaticResource RoundButtonBaseStyle}">

            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <DockPanel x:Name="RightButton">
                            <Grid DockPanel.Dock="Top" >
                                <Ellipse x:Name="Circle" StrokeThickness="1.5" Width="30" Height="30"  Stretch="Fill" StrokeLineJoin="Round" Stroke="{TemplateBinding Foreground}" 
								    Fill="{TemplateBinding Background}"/>
                                <Grid x:Name="Left" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
                                    <Path x:Name="arrow1" Margin="6,0,0,0" Width="7.4" Height="9"  Stretch="Fill" Fill="{TemplateBinding Foreground}" Data="F1 M 293.539,168.045L 296.669,165.023L 293.539,162.036L 293.539,162.006L 295.836,162.006L 295.836,162.002L 295.839,162.006L 295.841,162.006L 295.841,162.007L 299.737,165.007L 299.737,165.014L 295.839,168.055L 295.839,168.075L 293.948,168.075L 293.539,168.045 Z "/>
                                    <Path x:Name="arrow2" Width="13" Height="1.5" Stretch="Fill" StrokeThickness="1.5" StrokeLineJoin="Round" Stroke="{TemplateBinding Foreground}" Data="F1 M 289.633,165.038L 296.802,165.038"/>
                                    <Grid.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform/>
                                            <SkewTransform/>
                                            <RotateTransform Angle="180"/>
                                            <TranslateTransform/>
                                        </TransformGroup>
                                    </Grid.RenderTransform>
                                </Grid>
                            </Grid>
                            <ContentPresenter DockPanel.Dock="Bottom" x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" 
							HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 							
							RecognizesAccessKey="True">
                                <ContentPresenter.Resources>
                                    <Style TargetType="TextBlock">
                                        <Setter Property="Foreground" Value="#8D8D8D"/>
                                    </Style>
                                </ContentPresenter.Resources>
                            </ContentPresenter>
                        </DockPanel>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Controls:MetroWindow.Resources>

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="50" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="50" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Rectangle Width="10" HorizontalAlignment="Left" Fill="LightBlue"/>
        <Button Style="{StaticResource NavigateRightButtonStyle}" Visibility="{Binding IsPageShow, Converter={StaticResource BooleanToVisibilityConverter}}"
                HorizontalAlignment="Right" VerticalAlignment="Center">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="Click">
                    <i:InvokeCommandAction Command="{Binding BackCommand}" CommandParameter="{Binding ElementName=ModelLists}"/>
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </Button>
        <TextBlock Text="{Binding DisplayName}" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center"
                   FontFamily="Microsoft YaHei" FontSize="26"/>
        <ListBox x:Name="ModelLists" ItemsSource="{Binding ModleApplications}" Grid.Row="1" Grid.Column="1" 
                 SnapsToDevicePixels="True" BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                 Visibility="{Binding IsPageShow, Converter={StaticResource BooleanToVisibilityReverseConverter}}" 
                 cal:Message.Attach="[Event SelectionChanged]=[Action ModelSelected($this.SelectedItem)]">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel/>
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBox.ItemContainerStyle>
                <Style TargetType="ListBoxItem">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="ListBoxItem">
                                <Grid>
                                    <ContentPresenter/>
                                    <Border x:Name="border" BorderBrush="#FF297DED" BorderThickness="10"
                                            Visibility="Collapsed" />

                                </Grid>

                                <ControlTemplate.Triggers>
                                    <Trigger Property="IsMouseOver" Value="True">
                                        <Setter TargetName="border" Property="Visibility" Value="Visible"/>
                                        <Setter Property="Cursor" Value="Hand"/>
                                    </Trigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </ListBox.ItemContainerStyle>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid Margin="10">
                        <Image Source="{Binding ImageUri}" Width="150" Height="150"/>
                        <TextBlock Text="{Binding Name}" FontFamily="Microsoft YaHei" VerticalAlignment="Bottom"
                                   HorizontalAlignment="Center" Foreground="White" FontSize="20"/>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <ItemsControl x:Name="Items"  Grid.Row="1" Grid.Column="1" 
                       >
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <Grid />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
        </ItemsControl>
        <!--local:StateManager.CurrentStateProperty="{Binding State}"-->
        <!--<VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="VisualStateGroup">
                    <VisualStateGroup.Transitions>
                        <VisualTransition GeneratedDuration="0"/>
                    </VisualStateGroup.Transitions>
                    <VisualState
                    x:Name="shown">
                        <Storyboard>
                            
                            <DoubleAnimation Storyboard.TargetName="Items" Storyboard.TargetProperty="Opacity" From="0" To="1"
                                             Duration="0:0:5"/>
                        </Storyboard>
                    </VisualState>
                	<VisualState
                    x:Name="hidden">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames
                            Storyboard.TargetProperty="(UIElement.Visibility)"
                            Storyboard.TargetName="Items" Duration="0:0:5">
                                <DiscreteObjectKeyFrame
                                KeyTime="5">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Collapsed</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>-->
    </Grid>
</Controls:MetroWindow>
